




********************************************************
** Table 2
********************************************************

global data="C:\CFLs\Data\"
global outputs="C:\CFLs\Outputs\"

clear
clear matrix
clear mata

set maxvar 10000
cd "$data"

global format=`"nogap label nostar starlevels(* 0.1 ** 0.05 *** 0.01) collabels(none) cells(b(star fmt(3) label(Coef.)) se(par fmt(3) label(Std.Err.))) csv"'
global statsFEshort=`"stats(N r2, fmt(0 a2) labels("Observations" "R-squared")) "'



use "CFLs_data.dta" , clear

label var  s5_17_b  "baseline days wout electricity (per month)" 
label var  s5_17_f  "followup days wout electricity (per month)" 

label var TG_low  "low saturation transformer"
label var TG_high "high saturation transformer"

label var T "Treated household"

label var  TG_low_T  "Treated household in low saturation transformer"
label var  TG_high_T "Treated household in high saturation transformer"
  
******************************
** regs w/ OUTAGE outcomes 
******************************


tabstat s5_17_f if TG_low==0 & TG_high==0


** 1. Outages 
cd "$outputs"
global regoutfile="TABLE_outages_RESTATv2.csv"
capture: erase $regoutfile
eststo clear 

* Col 1. 
eststo: reg s5_17_f  TG_low TG_high    hh_count_ ,  cluster(within_village_cluster)  
test TG_low = TG_high 


* Col 2. 
eststo: reg s5_17_f  TG_low TG_high  T    hh_count_ ,  cluster(within_village_cluster)  
test TG_low = TG_high 


* Col 3. 
eststo: reg s5_17_f  TG_low TG_high   TG_low_T TG_high_T    hh_count_ ,  cluster(within_village_cluster)  
test TG_low = TG_high 


* Col 4. 
eststo: reg s5_17_f  TG_low TG_high   TG_low_T TG_high_T  s5_17_b   hh_count_ ,  cluster(within_village_cluster)  
test TG_low = TG_high 

esttab using $regoutfile,   $format $statsFEshort append 



